<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
                      "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
    <meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
    <title>Consuming an Atom Feed - Zend Framework Manual</title>

    <link href="../css/shCore.css" rel="stylesheet" type="text/css" />
    <link href="../css/shThemeDefault.css" rel="stylesheet" type="text/css" />
    <link href="../css/styles.css" media="all" rel="stylesheet" type="text/css" />
</head>
<body>
<h1>Zend Framework</h1>
<h2>Programmer's Reference Guide</h2>
<ul>
    <li><a href="../en/zend.feed.consuming-atom.html">Inglês (English)</a></li>
    <li><a href="../pt-br/zend.feed.consuming-atom.html">Português Brasileiro (Brazilian Portuguese)</a></li>
</ul>
<table width="100%">
    <tr valign="top">
        <td width="85%">
            <table width="100%">
                <tr>
                    <td width="25%" style="text-align: left;">
                    <a href="zend.feed.consuming-rss.html">Consuming an RSS Feed</a>
                    </td>

                    <td width="50%" style="text-align: center;">
                        <div class="up"><span class="up"><a href="zend.feed.html">Zend_Feed</a></span><br />
                        <span class="home"><a href="manual.html">Guia de Refer&ecirc;ncia do Programador</a></span></div>
                    </td>

                    <td width="25%" style="text-align: right;">
                        <div class="next" style="text-align: right; float: right;"><a href="zend.feed.consuming-atom-single-entry.html">Consuming a Single Atom Entry</a></div>
                    </td>
                </tr>
            </table>
<hr />
<div id="zend.feed.consuming-atom" class="section"><div class="info"><h1 class="title">Consuming an Atom Feed</h1></div>
    

    <p class="para">
        <span class="classname">Zend_Feed_Atom</span> is used in much the same way as
        <span class="classname">Zend_Feed_Rss</span>. It provides the same access to feed-level properties
        and iteration over entries in the feed. The main difference is in the structure of the Atom
        protocol itself. Atom is a successor to <acronym class="acronym">RSS</acronym>; it is more generalized
        protocol and it is designed to deal more easily with feeds that provide their full content
        inside the feed, splitting <acronym class="acronym">RSS</acronym>&#039; <span class="property">description</span> tag into
        two elements, <span class="property">summary</span> and <span class="property">content</span>, for that
        purpose.
    </p>

    <div class="example" id="zend.feed.consuming-atom.example.usage"><div class="info"><p><b>Example #1 Basic Use of an Atom Feed</b></p></div>
        

        <div class="example-contents"><p>
            Read an Atom feed and print the <span class="property">title</span> and
            <span class="property">summary</span> of each entry:
        </p></div>

        <pre class="programlisting brush: php">
$feed = new Zend_Feed_Atom(&#039;http://atom.example.com/feed/&#039;);
echo &#039;The feed contains &#039; . $feed-&gt;count() . &#039; entries.&#039; . &quot;\n\n&quot;;
foreach ($feed as $entry) {
    echo &#039;Title: &#039; . $entry-&gt;title() . &quot;\n&quot;;
    echo &#039;Summary: &#039; . $entry-&gt;summary() . &quot;\n\n&quot;;
}
</pre>

    </div>

    <p class="para">
        In an Atom feed you can expect to find the following feed properties:
    </p>

    <ul class="itemizedlist">
        <li class="listitem">
            <p class="para">
                <span class="property">title</span> - The feed&#039;s title, same as <acronym class="acronym">RSS</acronym>&#039;s
                 channel title
            </p>
        </li>

        <li class="listitem">
            <p class="para">
                <span class="property">id</span> - Every feed and entry in Atom has a unique identifier
            </p>
        </li>

        <li class="listitem">
            <p class="para">
                <span class="property">link</span> - Feeds can have multiple links, which are
                distinguished by a <span class="property">type</span> attribute
            </p>

            <p class="para">
                The equivalent to <acronym class="acronym">RSS</acronym>&#039;s channel link would be
                <strong class="command">type=&quot;text/html&quot;</strong>. if the link is to an alternate version of
                the same content that&#039;s in the feed, it would have a
                <strong class="command">rel=&quot;alternate&quot;</strong> attribute.
            </p>
        </li>

        <li class="listitem">
            <p class="para">
                <span class="property">subtitle</span> - The feed&#039;s description, equivalent to
                <acronym class="acronym">RSS</acronym>&#039; channel description
            </p>

            <p class="para"><span class="property">author-&gt;name()</span> - The feed author&#039;s name</p>
            <p class="para"><span class="property">author-&gt;email()</span> - The feed author&#039;s email address</p>
        </li>
    </ul>

    <p class="para">
        Atom entries commonly have the following properties:
    </p>

    <ul class="itemizedlist">
        <li class="listitem">
            <p class="para"><span class="property">id</span> - The entry&#039;s unique identifier</p>
        </li>

        <li class="listitem">
            <p class="para">
                <span class="property">title</span> - The entry&#039;s title, same as <acronym class="acronym">RSS</acronym>
                item titles
            </p>
        </li>

        <li class="listitem">
            <p class="para">
                <span class="property">link</span> - A link to another format or an alternate view of
                this entry
            </p>
        </li>

        <li class="listitem">
            <p class="para"><span class="property">summary</span> - A summary of this entry&#039;s content</p>
        </li>

        <li class="listitem">
            <p class="para">
                <span class="property">content</span> - The full content of the entry; can be skipped if
                the feed just contains summaries
            </p>
        </li>

        <li class="listitem">
            <p class="para">
                <span class="property">author</span> - with <span class="property">name</span> and
                <span class="property">email</span> sub-tags like feeds have
            </p>
        </li>

        <li class="listitem">
            <p class="para">
                <span class="property">published</span> - the date the entry was published, in
                <acronym class="acronym">RFC</acronym> 3339 format
            </p>
        </li>

        <li class="listitem">
            <p class="para">
                <span class="property">updated</span> - the date the entry was last updated, in
                <acronym class="acronym">RFC</acronym> 3339 format
            </p>
        </li>
    </ul>

    <p class="para">
        For more information on Atom and plenty of resources, see
        <a href="http://www.atomenabled.org/" class="link external">&raquo; http://www.atomenabled.org/</a>.
    </p>
</div>
        <hr />

            <table width="100%">
                <tr>
                    <td width="25%" style="text-align: left;">
                    <a href="zend.feed.consuming-rss.html">Consuming an RSS Feed</a>
                    </td>

                    <td width="50%" style="text-align: center;">
                        <div class="up"><span class="up"><a href="zend.feed.html">Zend_Feed</a></span><br />
                        <span class="home"><a href="manual.html">Guia de Refer&ecirc;ncia do Programador</a></span></div>
                    </td>

                    <td width="25%" style="text-align: right;">
                        <div class="next" style="text-align: right; float: right;"><a href="zend.feed.consuming-atom-single-entry.html">Consuming a Single Atom Entry</a></div>
                    </td>
                </tr>
            </table>
</td>
        <td style="font-size: smaller;" width="15%"> <style type="text/css">
#leftbar {
	float: left;
	width: 186px;
	padding: 5px;
	font-size: smaller;
}
ul.toc {
	margin: 0px 5px 5px 5px;
	padding: 0px;
}
ul.toc li {
	font-size: 85%;
	margin: 1px 0 1px 1px;
	padding: 1px 0 1px 11px;
	list-style-type: none;
	background-repeat: no-repeat;
	background-position: center left;
}
ul.toc li.header {
	font-size: 115%;
	padding: 5px 0px 5px 11px;
	border-bottom: 1px solid #cccccc;
	margin-bottom: 5px;
}
ul.toc li.active {
	font-weight: bold;
}
ul.toc li a {
	text-decoration: none;
}
ul.toc li a:hover {
	text-decoration: underline;
}
</style>
 <ul class="toc">
  <li class="header home"><a href="manual.html">Guia de Refer&ecirc;ncia do Programador</a></li>
  <li class="header up"><a href="manual.html">Guia de Refer&ecirc;ncia do Programador</a></li>
  <li class="header up"><a href="reference.html">Refer&ecirc;ncia do Zend Framework</a></li>
  <li class="header up"><a href="zend.feed.html">Zend_Feed</a></li>
  <li><a href="zend.feed.introduction.html">Introduction</a></li>
  <li><a href="zend.feed.importing.html">Importing Feeds</a></li>
  <li><a href="zend.feed.findFeeds.html">Retrieving Feeds from Web Pages</a></li>
  <li><a href="zend.feed.consuming-rss.html">Consuming an RSS Feed</a></li>
  <li class="active"><a href="zend.feed.consuming-atom.html">Consuming an Atom Feed</a></li>
  <li><a href="zend.feed.consuming-atom-single-entry.html">Consuming a Single Atom Entry</a></li>
  <li><a href="zend.feed.modifying-feed.html">Modifying Feed and Entry structures</a></li>
  <li><a href="zend.feed.custom-feed.html">Custom Feed and Entry Classes</a></li>
  <li><a href="zend.feed.reader.html">Zend_Feed_Reader</a></li>
  <li><a href="zend.feed.writer.html">Zend_Feed_Writer</a></li>
  <li><a href="zend.feed.pubsubhubbub.introduction.html">Zend_Feed_Pubsubhubbub</a></li>
 </ul>
 </td>
    </tr>
</table>

<script type="text/javascript" src="../js/shCore.js"></script>
<script type="text/javascript" src="../js/shAutoloader.js"></script>
<script type="text/javascript" src="../js/main.js"></script>

</body>
</html>